package nl.jookar.android.tafeltrainer;
import nl.jookar.android.tafeltrainer.R;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.util.Log;
import android.widget.Button;

/**
 * 
 */

/**
 * @author Joost
 *
 */
public class NumberButton extends Button {

	public NumberButton(Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);
		this.init(context, attrs);
	}

	public NumberButton(Context context, AttributeSet attrs) {
		super(context, attrs);
		this.init(context, attrs);
	}

	public NumberButton(Context context) {
		super(context);
		this.init(context, null);
	}
	
	private void init(Context context, AttributeSet attrs) {
		//this.setTextSize(getResources().getDimension(R.dimen.btnTextSize));
		/*
		if (attrs == null) {
			this.setTextSize(30);
			Log.e(VIEW_LOG_TAG, "No attrs read");
		} else {
			float txtSize = attrs.getAttributeFloatValue("android", "textSize", 30);
			this.setTextSize(txtSize);
			Log.e(VIEW_LOG_TAG, "txtSize = " + txtSize);
		}
		*/
		TypedArray a = context.getTheme().obtainStyledAttributes(
		        attrs,
		        R.styleable.nl_jookar_android_tafeltrainer_NumberButton,
		        0, 0);
		float txtSize = a.getDimension(R.styleable.nl_jookar_android_tafeltrainer_NumberButton_txtSize, 30);
		this.setTextSize(txtSize);
		Log.e(VIEW_LOG_TAG, "txtSize = " + txtSize);
	}

}
